<!doctype html>
<html lang="en">

<head>
	<title>管理首页</title>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<!-- VENDOR CSS -->
	<link rel="stylesheet" href="../../static/assets/vendor/bootstrap/css/bootstrap.min.css">
	<link rel="stylesheet" href="../../static/assets/vendor/font-awesome/css/font-awesome.min.css">
	<link rel="stylesheet" href="../../static/assets/vendor/linearicons/style.css">
	<link rel="stylesheet" href="../../static/assets/vendor/chartist/css/chartist-custom.css">
	<!-- MAIN CSS -->
	<link rel="stylesheet" href="../../static/assets/css/main.css">
	<!-- FOR DEMO PURPOSES ONLY. You should remove this in your loan -->
	<link rel="stylesheet" href="../../static/assets/css/demo.css">
	<link rel="stylesheet" href="../../static/assets/css/zeroModal.css">

	<!-- GOOGLE FONTS -->
	<!-- <link href="../../static/assets/fonts/googleapi.css?family=Source+Sans+Pro:300,400,600,700" rel="stylesheet"> -->
	<link href="../../static/assets/fonts/googleapi.css?family=Source+Sans+Pro:300,400,600,700" rel="stylesheet"> 
	<!-- ICONS -->
	<link rel="apple-touch-icon" sizes="76x76" href="../../static/assets/img/apple-icon.png">
	<link rel="icon" type="image/png" sizes="96x96" href="../../static/assets/img/favicon.png">
</head>

<body>
	<!-- WRAPPER -->
	<div id="wrapper">
		<!-- NAVBAR -->
		<nav class="navbar navbar-default navbar-fixed-top">
			<div class="brand">
				<a href="./index.html">
					<img src="../../static/assets/img/logo-dark.png" alt="Klorofil Logo" class="img-responsive logo">
				</a>
			</div>
			<div class="container-fluid">
				<div class="navbar-btn">
					<button type="button" class="btn-toggle-fullwidth">
						<i class="lnr lnr-arrow-left-circle"></i>
					</button>
				</div>
				<div id="navbar-menu" >
					<ul class="nav navbar-nav navbar-right">
						<!-- <li class="dropdown">                     <a href="#" class="dropdown-toggle icon-menu" data-toggle="dropdown">                         <i class="lnr lnr-alarm"></i>                         <span class="badge bg-danger">3</span>                     </a>                     <ul class="dropdown-menu notifications">                         <li><a href="#" class="notification-item"><span class="dot bg-warning"></span>警示信息</a></li>                         <li><a href="#" class="notification-item"><span class="dot bg-danger"></span>紧急信息</a></li>                         <li><a href="#" class="notification-item"><span class="dot bg-success"></span>普通信息</a></li>                         <li><a href="#" class="more">查看所有信息</a></li>                     </ul>                 </li> -->
						<li class="dropdown">
							<a href="#" class="dropdown-toggle" data-toggle="dropdown">
								<img src="../../static/assets/img/user.png" class="img-circle" alt="Avatar">
								<span id="header-username">管理员1</span>
								<i class="icon-submenu lnr lnr-chevron-down"></i>
							</a>
							<ul class="dropdown-menu">
								<li>
									<a href="./userinfo.html">
										<i class="lnr lnr-user"></i>
										<span>我的资料</span>
									</a>
								</li>
								<li>
									<a href="javascript: doLogout()">
										<i class="lnr lnr-exit"></i>
										<span>退出登录</span>
									</a>
								</li>
							</ul>
						</li>
					</ul>
				</div>
			</div>
		</nav>
		<!-- END NAVBAR -->
		<!-- LEFT SIDEBAR -->
		<div id="sidebar-nav" class="sidebar" style="width: 200px;">
			<div class="sidebar-scroll">
				<nav id="admin_menu_nav_c"></nav>
			</div>
		</div>
		<!-- END LEFT SIDEBAR -->
		<!-- MAIN -->
		<div class="main">
			<!-- MAIN CONTENT -->
			<div class="main-content">
				<div class="container-fluid">
					<!-- OVERVIEW -->
					<div class="panel panel-headline">
						<img src="../../static/assets/img/top_pic.jpg" width="100%" alt="" /> </div>
					<!-- END OVERVIEW -->
					<div class="row">
						<div class="col-md-12">
							<!-- RECENT PURCHASES -->
							<div class="panel">
								<div class="panel-heading">
									<h3 class="panel-title">企业管理</h3>
									<div class="right">
										<button type="button" class="btn-toggle-collapse">
											<i class="lnr lnr-chevron-up"></i>
										</button>
										<button type="button" class="btn-remove">
											<i class="lnr lnr-cross"></i>
										</button>
									</div>
								</div>
								<div class="panel-body no-padding">
									<table class="table table-striped">
										<thead>
											<tr>
												<th style="max-width:70px;word-wrap:break-word;word-break:keep-all; white-space:nowrap;text-overflow:ellipsis;overflow:hidden;">编号</th>
												<th>企业名称</th>
												<th style="max-width:80px;word-wrap:break-word;word-break:keep-all; white-space:nowrap;text-overflow:ellipsis;overflow:hidden;">单位类型</th>
												<th>申请时间</th>
												<th>状态</th>
											</tr>
										</thead>
										<tbody id="enterprise-list">

										</tbody>
									</table>
								</div>
								<div class="panel-footer">
									<div class="row">
										<div class="col-md-6">
											<span class="panel-note">
												<i class="fa fa-clock-o"></i>24小时最新状态</span>
										</div>
										<div class="col-md-6 text-right">
											<a href="#" class="btn btn-primary" onclick="newEnterprise();">显示新申请企业</a>
										</div>
									</div>
								</div> 
							</div>
							<!-- END RECENT PURCHASES -->
						</div>
						<div class="col-md-12">
							<!-- MULTI CHARTS -->
							<div class="panel">
								<div class="panel-heading">
									<h3 class="panel-title">项目管理</h3>
									<div class="right">
										<button type="button" class="btn-toggle-collapse">
											<i class="lnr lnr-chevron-up"></i>
										</button>
										<button type="button" class="btn-remove">
											<i class="lnr lnr-cross"></i>
										</button>
									</div>
								</div>
								<div class="panel-body no-padding">
									<table class="table table-striped">
										<thead>
											<tr>
												<th style="max-width:70px;word-wrap:break-word;word-break:keep-all; white-space:nowrap;text-overflow:ellipsis;overflow:hidden;">编号</th>
												<th >企业名称</th>
												<th style="max-width:80px;word-wrap:break-word;word-break:keep-all; white-space:nowrap;text-overflow:ellipsis;overflow:hidden;">单位类型</th>
												<th >项目</th>
												<th>申请时间</th>
												<th>状态</th>
											</tr>
										</thead>
										<tbody id="project-list">
											<tr>
												<td>
													<a href="#">763648</a>
												</td>
												<td>补助</td>
												<td>济南老舍茶馆</td>
												<td>2018-6-9</td>
												<td>
													<span class="label label-success">已通过</span>
												</td>
											</tr>
										</tbody>
									</table>
								</div>
								 <div class="panel-footer">
									<div class="row">
										<div class="col-md-6">
											<span class="panel-note">
												<i class="fa fa-clock-o"></i>24小时最新状态</span>
										</div>
										<div class="col-md-6 text-right">
											<a href="#" class="btn btn-primary" onclick="newProject();">显示新项目</a>
										</div>
									</div>
								</div> 
							</div>
							<!-- END MULTI CHARTS -->
						</div>
					</div>

				</div>
			</div>
			<!-- END MAIN CONTENT -->
		</div>
		<!-- END MAIN -->
		<div class="clearfix"></div>
  <footer style="width: 100%">
            <div class="container-fluid">
                <p class="copyright" style="text-align: center;">Copyright &copy; 2018.Company name All rights reserved
                    <a href="#" target="_blank" title="">技术支持·</a>　|
                    <a href="#" title="" target="_blank">作者</a>
                </p>
            </div>
        </footer>
	</div>
	<!-- END WRAPPER -->
	<!-- Javascript -->
	<script src="../../static/assets/vendor/jquery/jquery.min.js"></script>
	<script src="../../static/assets/vendor/bootstrap/js/bootstrap.min.js"></script>
	<script src="../../static/assets/vendor/jquery-slimscroll/jquery.slimscroll.min.js"></script>
	<script src="../../static/assets/vendor/jquery.easy-pie-chart/jquery.easypiechart.min.js"></script>
	<script src="../../static/assets/scripts/klorofil-common.js"></script>
	<script src="../../static/assets/scripts/zeroModal.min.js"></script>
	<script src="../../static/assets/scripts/admin.js"></script>

</body>
<script>
	var userinfo = null;
	var pageRows = 10;

	var enterpriseParam={
			page: 1,
			rows: pageRows,
			order: "desc",
			sort: "createTime",
			hourIn24:"hourIn24"
	};
	var projectParam={
			page: 1,
			rows: pageRows,
			order: "desc",
			sort: "createTime",
			hourIn24:"hourIn24"
	};
	(function init() {
		setUserInfoHeader();

		ajaxEnterprise(enterpriseParam);

		ajaxProject(projectParam)
	})()
	
	var newE=true;
	function newEnterprise(){
		if(newE){
			enterpriseParam=$.extend(enterpriseParam, {reviewFinalResult:0});
			newE=false;
		}else{
			enterpriseParam=$.extend(enterpriseParam, {reviewFinalResult:null});
			newE=true;
		}
		ajaxEnterprise(enterpriseParam);
	}
	var newP=true;
	function newProject(){
		if(newP){
			enterpriseParam=$.extend(enterpriseParam, {reviewFinalResult:0});
			newP=false;
		}else{
			enterpriseParam=$.extend(enterpriseParam, {reviewFinalResult:null});
			newP=true;
		}
		ajaxProject(enterpriseParam);
	}
	function ajaxEnterprise(params) {
		// 获取当前用户的企业信息申报表
		request({
			url: API_DOMAIN + 'admin/culture/cultureDeclarCorporate/loadCultureDeclarCorporateDataSet',
			data: params,
			success: function (result) {
				//当前账号未申报企业信息
				if (result.statusCode === 200) {
					// 渲染列表
					var html = '';
					result.data.dataSet.rows.forEach(function (item) {
						html += '<tr>\n' +
							'<td>' + item.id + '</td>\n' +
							'<td style="max-width:180px;word-wrap:break-word;word-break:keep-all; white-space:nowrap;text-overflow:ellipsis;overflow:hidden;"><a href="./enterprisedeclaredetail.html?id='+item.id +'&activeId=enterprisedeclaredetail-city&operateType=detail">'+item.corporateName + '</a></td>\n' +
							//'<td>' + getCorporateTypeText(item.corporateType) + '</td>\n' +
							'<td>' + item.belongReginName + '</td>\n' +
							'<td style="max-width:100px;word-wrap:break-word;word-break:keep-all; white-space:nowrap;text-overflow:ellipsis;overflow:hidden;">' + item.createTime + '</td>\n' +
							'<td>' + getFinaleReviewResultText(item.reviewFinalResult, item.status, item.corporateType, 'button') + '</td>\n' +
							'</tr>';
					})
					document.getElementById('enterprise-list').innerHTML = html;
				}
			}
		})
	}

	function ajaxProject(params) {
		// 获取当前用户的企业信息申报表
		request({
			url: API_DOMAIN + 'admin/culture/cultureDeclarProject/loadCultureDeclarProjectDataSet',
			data: params,
			success: function (result) {
				//当前账号未申报企业信息
				if (result.statusCode === 200) {
					// 渲染列表
					var html = '';
					result.data.dataSet.rows.forEach(function (item) {
						html += '<tr>\n' +
							'<td style="max-width:40px;word-wrap:break-word;word-break:keep-all; white-space:nowrap;text-overflow:ellipsis;overflow:hidden;">' + item.id + '</td>\n' +
							'<td style="max-width:180px;word-wrap:break-word;word-break:keep-all; white-space:nowrap;text-overflow:ellipsis;overflow:hidden;">'+item.corporateName + '</td>\n' +
							//'<td>' + getCorporateTypeText(item.corporateType) + '</td>\n' +
							'<td style="max-width:80px;word-wrap:break-word;word-break:keep-all; white-space:nowrap;text-overflow:ellipsis;overflow:hidden;">' + item.belongReginName + '</td>\n' +
							'<td style="max-width:220px;word-wrap:break-word;word-break:keep-all; white-space:nowrap;text-overflow:ellipsis;overflow:hidden;"><a href="./projectdetail.html?id='+item.id +'">' + item.projectName + '</a></td>\n' +
							'<td style="max-width:100px;word-wrap:break-word;word-break:keep-all; white-space:nowrap;text-overflow:ellipsis;overflow:hidden;">' + item.createTime + '</td>\n' +
							'<td>' + getFinaleReviewResultText(item.reviewFinalResult, item.status, item.corporateType, 'button') + '</td>\n' +
							'</tr>';
					})
					document.getElementById('project-list').innerHTML = html;
				}
			}
		})
	}

	
</script>

</html>